package gummachine.state;

import gummachine.GumballMachine;

/**
 * @author yuanml
 */
public class HasQuarterState implements State {
    transient private GumballMachine gumballMachine;
    public HasQuarterState(GumballMachine gumballMachine) {
        this.gumballMachine = gumballMachine;
    }
    @Override
    public void insertQuarter() {
        System.out.println("You can't insert another quarter");
    }

    @Override
    public void ejectQuarter() {
        System.out.println("eject quarter");
        this.gumballMachine.setState(gumballMachine.getNoQuarterState());
    }

    @Override
    public void turnCrank() {
        System.out.println("You turned thr crank, a gum ball will come soon");
        this.gumballMachine.setState(gumballMachine.getSoldState());
    }

    @Override
    public void dispense() {
        System.out.println("No gum ball dispensed");
    }
}
